package com.qfedu.food.controller;

import com.github.pagehelper.PageInfo;
import com.qfedu.food.dao.TFoodDao;
import com.qfedu.food.dto.PageDto;
import com.qfedu.food.dto.TFoodDto;
import com.qfedu.food.pojo.TFood;
import com.qfedu.food.service.intf.TFoodService;
import com.qfedu.food.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("food/")
@Api(tags = "实现Food各种操作")
public class TFoodController {

    @Autowired
    private TFoodService service;
    @ApiOperation(value = "实现查询所有的菜",notes = "实现查询所有的菜")
    @GetMapping("/all.do")
    public R selectFoodAll(){

        return R.ok(service.selectFoodAll());
    }


    @ApiOperation(value = "实现查询单个菜",notes = "实现查询单个菜")
    @GetMapping("/foodId.do")
    public R selectFoodById(long id){

        return R.ok(service.selectFoodById(id));
    }

    @ApiOperation(value = "实现查询模糊查询以及分页",notes = "实现查询模糊查询以及分页")
    @GetMapping(value = "foodPage.do",produces = "application/json;charset=UTF-8")
    public R selectFoodAllPage(@RequestBody PageDto dto){
            return service.selectFoodAllPage(dto);
    }


}
